package com.example.demo.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.mapper.AlbumMapper;
import com.example.demo.pojo.Album;
import com.example.demo.pojo.User;
import com.example.demo.service.AlbumService;

@Service
public class AlbumServiceImpl implements AlbumService {

	@Autowired
	private AlbumMapper albummapper;
	@Override
	public List<Album> getAlbumList() {
		// TODO Auto-generated method stub
		return albummapper.getAlbumList();
	}
	@Override
	public List<Album> searchAlbumList(String album_name) {
		// TODO Auto-generated method stub
		return albummapper.searchAlbumList(album_name);
	}
	@Override
	public int addAlbum(Album album) {
		// TODO Auto-generated method stub
		return  albummapper.addAlbum(album);
	}
	@Override
	public boolean deleteAlbum(Album album) {
		try {
			albummapper.deleteAlbum(album);
			return true;
			}
			catch(Exception e) 
			{
				e.printStackTrace();
		return false;
			}
	}
	
	@Override
	public Album getList(int album_id) {
		// TODO Auto-generated method stub
		return albummapper.getList(album_id);
	}


	@Override
	public boolean updateAlbum(Album album) {
		// TODO Auto-generated method stub
		try {
			albummapper.updateAlbum(album);
			return true;
		}
		catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
}
